home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.3 KB | 58 lines | [TEXT/MSET] |
- (*
-
- Class pen is intended for subclassing for any object that draws
- itself on the screen and could be affected by the window's pen
- settings. We default to a 1 pixel black pen. Objects that use
- the pen class are easier to draw if we want a variety of pen
- widths, patterns, etc. without affecting other objects that use
- the Mac toolbox pen.
-
- Note that any changes via size:, pattern:, or mode: *must* be followed
- with a set: in order to take effect. This is done to minimize the time
- taken to call toolbox traps and send messages to syspat.
-
- See IM I-474 for the Standard Pattern numbers that should be passed with
- the pattern: message ( 0 through 37, subtract 1 from the indices shown in IM
- because we wish to maintain the Mops convention of always using 0-based
- indexes).
-
- *)
-
-
- :class pen super{ object }
- int width
- int height
- int mode \ transfer mode
- int pat# \ will be an index to the system pattern list
-
- :m classinit:
- 1 put: width
- 1 put: height
- konst patCopy put: mode
- 0 put: pat# \ black
- ;m
-
- :m set:
- get: pat# syspat get: ** call PenPat
- get: width get: height pack call PenSize
- int: mode call PenMode ;m
-
- \ must call setPen: after any of these for changes to take effect
-
- :m size: ( w h -- )
- put: height put: width ;m
-
- :m mode: ( mode -- )
- put: mode ;m
-
- :m pattern: ( idx -- )
- put: pat# ;m
-
- ;class
-
- endload
-
- *** EXAMPLE USE
-
- See class graphicRect.
-